//
//  LoginQDCtrl.m
//  qddemo
//
//  Created by apple on 12-5-18.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "LoginQDCtrl.h"

@implementation LoginQDCtrl

- (void)setQuickDialogTableView:(QuickDialogTableView *)aQuickDialogTableView {
    [super setQuickDialogTableView:aQuickDialogTableView];
    
    self.quickDialogTableView.backgroundColor = [UIColor colorWithHue:0.1174 saturation:0.7131 brightness:0.8618 alpha:1.0000];
    self.quickDialogTableView.bounces = NO;
//    self.quickDialogTableView.styleProvider = self;
    
//    ((QEntryElement *)[self.root elementWithKey:@"login"]).delegate = self;
}

-(void) cell:(UITableViewCell *)cell willAppearForElement:(QElement *)element atIndexPath:(NSIndexPath *)indexPath{
    cell.backgroundColor = [UIColor colorWithRed:0.9582 green:0.9104 blue:0.7991 alpha:1.0000];
    
    if ([element isKindOfClass:[QEntryElement class]] || [element isKindOfClass:[QButtonElement class]]){
        cell.textLabel.textColor = [UIColor colorWithRed:0.6033 green:0.2323 blue:0.0000 alpha:1.0000];
    }   
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.quickDialogTableView.backgroundColor = [UIColor colorWithHue:0.1174 saturation:0.7131 brightness:0.8618 alpha:1.0000];

    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

+ (QRootElement *)createLoginForm {     
    
    //    Names *nameSet = [[[AppModel sharedModel] listOfNames] objectAtIndex:0];
    
    QRootElement *root = [[QRootElement alloc] init];
    root.controllerName = @"LoginForm";
    root.grouped = YES;
    root.title = @"用户登录";
    
    QSection *sectionWeibo = [[QSection alloc] init];
   
    sectionWeibo.title =@"微博帐号登录";
    
    QWebElement *sinaWeibo = [[QWebElement alloc] initWithTitle:@"新浪微博登录" url:@"http://www.haoshe.org"];
    [sectionWeibo addElement:sinaWeibo];
    

    QWebElement *tencentWeibo = [[QWebElement alloc] initWithTitle:@"腾讯微博登录" url:@"http://www.haoshe.org"];
    
    [sectionWeibo addElement:tencentWeibo];
    
    [root addSection:sectionWeibo];
    
    return root;
    
}

@end
